# Configure Script
AC_INIT([INC Parser], [0.0.1], [chandlerc@gmail.com], [inc_parser])

# initialize configure
AC_PREREQ([2.59])
AC_CONFIG_SRCDIR([./LICENSE])
AC_CONFIG_AUX_DIR([config_aux])
AC_CONFIG_HEADERS([config_aux/config.h])

# initialize automake
AM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip foreign subdir-objects])

# setup debugging options
AC_ARG_ENABLE([debug],
    [AS_HELP_STRING([--enable-debug],
                    [Build with debugging information and no optimizations])],
    [],[enable_debug=no])


# check programs
AS_IF([test "x$enable_debug" != xno],
      [AC_SUBST([CFLAGS], ["-g -O0 $CFLAGS"])])
AC_PROG_CC
AS_IF([test "x$enable_debug" != xno],
      [AC_SUBST([CXXFLAGS], ["-g -O0 $CXXFLAGS"])])
AC_PROG_CXX
AC_LANG([C++])
AC_PROG_LIBTOOL
DOLT

AC_ARG_VAR([LCOV], [Coverage collection command])
AC_PATH_PROG([LCOV], [lcov], [])
AC_ARG_VAR([GENHTML], [Coverage HTML report generation command])
AC_PATH_PROG([GENHTML], [genhtml], [])
AM_CONDITIONAL([ENABLE_COVERAGE], [test -f "$LCOV" && test -f "$GENHTML"])
AC_ARG_VAR([DOXYGEN], [Documentation generation tool])
AC_PATH_PROG([DOXYGEN], [doxygen], [])
AM_CONDITIONAL([ENABLE_DOXYGEN], [test -f "$DOXYGEN"])

# check libraries and library functions
GTEST_LIB_CHECK([1.0])
GTEST_LIBS="${GTEST_LIBS} -lgtest_main"

# TODO(chandlerc): Check for GMP > v4.2 to ensure we have C++ bindings.
AC_SUBST([GMP_LIBS], [-lgmp])
AC_SUBST([GMPXX_LIBS], [-lgmpxx])

# TODO(chandlerc): Check for MPFR > v2.3.0 and other good checking.
AC_SUBST([MPFR_LIBS], [-lmpfr])

# Boost library checks
AX_BOOST_BASE([1.33.0])
AX_BOOST_REGEX
AX_BOOST_PROGRAM_OPTIONS

# check headers

# check types, structures, and compiler characteristics

# check system services

# Doxygen
AC_CONFIG_FILES([doxygen.cfg])

# Files to configure
AC_CONFIG_FILES([Makefile])

# Do output
AC_OUTPUT

